<template>
  <div>
    <button @click="add">+</button><span>{{ goodsNum }}</span
    ><button @click="reduce">-</button>
  </div>
</template>
<script>
export default {
  props: ['goodsNum', 'min', 'max'],
  methods: {
    add () {
      if (this.goodsNum < this.max) {
        this.$emit('setGoodsNum')
      }
    },
    reduce () {
      if (this.goodsNum > this.min) {
        this.$emit('setGoodsNum2')
      }
    }
  }
}
</script>
<style></style>
